package com.bd1904.mock;

import org.apache.log4j.Logger;
import sun.rmi.runtime.Log;

import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.io.LineNumberReader;

public class MockData {
    public static void main(String[] args) throws IOException {
        if(args == null || args.length < 3){
            System.err.println("Usage：<inputpath> <Start> <step");
            System.exit(-1);
        }

        Logger logger = Logger.getLogger("access");
//        String path = "D:/dev/MytestFile/taobao-info.log";
        String path = args[0];
        LineNumberReader numberReader = new LineNumberReader(new FileReader(path));

        String line = null;
        int start = Integer.valueOf(args[1]);
        int end = start + Integer.valueOf(args[2]);
        while((line=numberReader.readLine())!=null){
            int lineNumber = numberReader.getLineNumber();
            if (lineNumber > start && lineNumber <=end){
                logger.info(line);
            }else if(lineNumber > end){
                break;
            }
        }
        numberReader.close();

    }
}
